import React, { Component } from 'react'
import { Pagination } from 'element-react'

class pagination extends Component {
  constructor (props) {
    super(props)
  }
  
  render () {
    return (
      <div>
      {function () {
        if (this.props.total > 10) {
          return (
            <div className="pagination" style={{display: 'flex', justifyContent: 'flex-end'}}>
              <Pagination
                layout="total, prev, pager, next"
                total={parseInt(this.props.total)}
                onCurrentChange={this.props.changePage.bind(this)}
              />
            </div>
          )
        }
      }.call(this)}
      </div>
    )
  }
}

export default pagination